package com.example.administrator.shihuo.activities;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.example.administrator.shihuo.R;

public class LauncherActivity extends AppCompatActivity {

    private Handler mHandler=new Handler(){
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            Intent intent=new Intent();
            switch (msg.what){
                case 0:
                    intent.setClass(LauncherActivity.this,MainActivity.class);
                    break;
                case 1:
                    break;
                default:
                    break;
            }
            startActivity(intent);
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_launcher);
        launch();
    }

    /**
     * 在这里获取sharepreference的值,然后再用handler发送不同的值
     * handler根据不同的结果跳转不同的界面
     *
     */
    private void launch() {
        //....这里根据sharepreference的值来判读该发送的值,根据不同的值来条转不同的界面

        mHandler.sendEmptyMessageDelayed(0,2000);
    }
}
